﻿using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace jQuery.Validation.DataAnnotations
{
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
    public sealed class RequiredAttribute : ValidationAttribute
    {

        public RequiredAttribute()
        {}

        public override bool IsValid(object value)
        {
            if (value == null || (value is string && ((string)value).Length == 0))
                return false;

            return true;
        }
    }
}
